#ifndef SHADER_LIBRARY_H_
#define SHADER_LIBRARY_H_

#include "glew.h"
#include "Logger.hpp"
#include <map>
#include <string>
#include <fstream>
#include <sstream>
#include <QtOpengl>
#include <assert.h>

class Shader;

class FragmentShader
{
public:
	FragmentShader( std::string filename, int id )
	: m_filename( filename ), m_id( id )
	{
	}
	
	std::string m_filename;
	int m_id;
};

class VertexShader
{
public:
	VertexShader( std::string filename, int id )
	: m_filename( filename ), m_id( id )
	{
	}
	
	std::string m_filename;
	int m_id;
};



class ShaderLibrary
{
public:
	static Shader* get( std::string name );
	static void add( Shader* shader, std::string name );
	
	static VertexShader* getVertexShader( std::string filename );
	static FragmentShader* getFragmentShader( std::string filename );
	
protected:
	static std::map<std::string, Shader*> cache;
	static std::map<std::string, VertexShader*> m_vertexShaders;
	static std::map<std::string, FragmentShader*> m_fragmentShaders;
	
private:
	static std::string loadFile( std::string &file );
};

#endif

